<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        div{
            width: 50px;
            height: 50px;
            background: url(astroIcon.png) no-repeat 0 -50px;
        }
    </style>
</head>
<body>
    <div class="ddd"></div>
    <div class="ddd">
        <a href="#">111</a>
    </div>
    <script>
    function $c(className){
        if(document.getElementsByClassName){
            return document.getElementsByClassName(className);
        }
        var arr = [];
        var dom = document.getElementsByTagName("*");
        for(var i=0;i<dom.length;i++){
            if(dom[i].className == className){
                arr.push(dom[i]);
            }
        }
        return arr;
    }
    // document.getElementsByClassName("ddd")[0]  不能再IE8获取
    $c("ddd")[1].getElementsByTagName("a")[0].style.color = "red";
    </script>
</body>
</html>